package cn.lili.modules.promotion.entity.dos;

import cn.lili.common.utils.StringUtils;
import cn.lili.mybatis.model.BaseStandardEntity;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableName;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;

import java.math.BigDecimal;

/**
 * @author xiangqian
 * @version 1.0
 * @data 2023/12/18 14:02
 */
@Data
@TableName("li_green_count")
@ApiModel(value = "绿色积分池-统计表")
public class GreenCount  extends BaseStandardEntity {

    @ApiModelProperty(value = "用户ID")
    private String userId;

    @ApiModelProperty(value = "会员用户名")
    private String username;

    @ApiModelProperty(value = "会员昵称")
    private String nickName;

    @ApiModelProperty(value = "会员头像")
    private String face;

    @ApiModelProperty(value = "当前贡献值")
    private BigDecimal umber;

    @ApiModelProperty(value = "已提现贡献值")
    private BigDecimal hasUmber;

    /*******************查询字段***********/
    @TableField(exist = false)
    @ApiModelProperty(value = "贡献值开始区间")
    private String beginUmber;

    @TableField(exist = false)
    @ApiModelProperty(value = "贡献值结束区间")
    private String endUmber;

    public LambdaQueryWrapper<GreenCount> queryWrapperPage() {
        LambdaQueryWrapper<GreenCount> lambdaQueryWrapper = new LambdaQueryWrapper<>();
        lambdaQueryWrapper.like(StringUtils.isNotEmpty(userId),GreenCount::getUserId,userId);
        lambdaQueryWrapper.like(StringUtils.isNotEmpty(nickName),GreenCount::getNickName,nickName);
        lambdaQueryWrapper.ge(StringUtils.isNotEmpty(beginUmber),GreenCount::getUmber,beginUmber);
        lambdaQueryWrapper.le(StringUtils.isNotEmpty(endUmber),GreenCount::getUmber,endUmber);
        lambdaQueryWrapper.eq(GreenCount::getDeleteFlag,false);
        lambdaQueryWrapper.orderByDesc(GreenCount::getCreateTime);
        return lambdaQueryWrapper;
    }
}
